-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removes use of necessary sqlite3 connection cursors and cached connections #478
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ro/refactoring # Conflicts: # aequilibrae/project/network/network.py
pedrocamargo
changed the title
removes use of necessary sqlite3 connection cursors
removes use of necessary sqlite3 connection cursors and cached connections
Dec 9, 2023
jamiecook
approved these changes
Dec 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one where i'm pretty glad we've got good tests.
Looking through it all seems to be fairly straightforward - hard to tell for sure without running everything though.
pedrocamargo
added a commit
that referenced
this pull request
Dec 16, 2023
* Models with no centroids (#472) * Bumps up version for release * Bumps up version for release * docs --------- Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Better network skimming and path computation headers and typo fix (#474) * Integration scaffolding * Transit assignment * Change "id" variable naming to avoid double underscores Double underscore variables are difficult to inherit without duplicating. I've tried my best to group all these renames into a single commit to be revertible but some others are deep within a refactor. This changes the convention of using `__id__` and `__graph_id__` to `_id` and `_graph_id`. Since these variables need to be accessible to other methods they are not private. The double underscore worked previously since there was only ever one class with these variables the name mangling was always correct. * Create GraphBase and TransitGraph classes * Create TransportClassBase and TransitClass classes * Create AssignmentBass and TransitAssignment classes * Create AssignmentResultsBase and AssignmentResultsTransit classes * Comments, add OptimalStrategies class * Incomplete (full) workflow * fixup! Incomplete (full) workflow * fixes export of omx matrices (#484) Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Move periods table * Lots of changes Limit graph loading and saving to a single graph for now Flush out results API, including saving and loading Move unrelated variables and methods * Add Periods and Period classes, similar to Nodes and Links classes * Remove period from database saving for now * Propagate period ids and various changes * Raise nicer errors * Style * removes use of necessary sqlite3 connection cursors and cached connections (#478) * removes use of necessary sqlite3 connection cursors * removes use of necessary sqlite3 connection cursors and saved connections * removes silly use of a cursor * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles --------- Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Migrate docs to new api, fix reloading graphs and begin updating tests. * Style and build errors * Typing * Revert changes to HyperpathGenerating and tests, use arrays instead * Exclude abstract methods from coverage tests * Period, Periods, TransitGraph, and TransitGraphBuilder tests * Style * Cleans graph creation (#482) Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Adds support page (#481) * updates examples * updates examples * Lower coverage requirement, typos * Remove patches * updates examples * fixup! Remove patches * Missing var * Deprecates Python 3.7 * Fixes documentation * Fixes documentation * code cleaning * code cleaning * code cleaning * updates setup classifiers * Fixes centroid assignment --------- Co-authored-by: Pedro Camargo <c@margo.co> Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
pedrocamargo
added a commit
that referenced
this pull request
Dec 16, 2023
* file transfer from the edsger package: shortest hyperpath algorithm * first try on compiling the public transport module * added the COO to CSC sparse format converter * Python interface to the Cythonized Spiess & Florian algorithm * assignment loop * just making sure zero entries are removed from the demand matrix * Spiess & Florian test case * assign method S&F test * added some compiler directives * combined cdefs * moved the allocation of f_i_vec outside of compute_SF_in * cleanup * moved the allocation of u_j_c_a_vec outside of compute_SF_in * cleanup * removed np.sum() * moved the allocation of u_i_vec outside of compute_SF_in * added a wrapper of the C function nqsort, in order to replace np.argsort * moved the allocation of edges_indices outside of compute_SF_in * released the gil in compute_SF_in * comment fix * added the initialization of the edge volume vector * Attempt parallelising PuT assignment * Further progress towards parallelisation * initialized the module for the S&F transit graph creation * handle the case of int data given as a float string * renaming * Complete parallelisation of PuT assignment over destinations * u_j_c_a_vec was being initialised to an incorrect size * Move parallelised call to compute_SF_in to separate function Introduced new accumulation buffer and dropped reacquisition of the gil * Use numpy asserts for nicer error messages Using default tolerances of previous asserts * Restore HyperpathGenerating.run() functionality * Style * create stop vertices * renamed a column * Fix openmp Windows * Spelling and default to using all available threads * Fix default thread amount * Move hyperpath testing and adjust testing structure Adds new parallel agreement test as well * Credit Bell's network construction * added the class global structure * using nullable Int type * filtering stops on a given time period * filtering patterns, routes ans building a line segment dataframe * bug fix * bug fix + filtering the stops corresponding to the given time range * removed a comment : segment index are 0-based and not 1-based as specifed before * created a method for the line segments dataframe + now creating the boarding vertices dataframe * creating the amighting vertices dataframe * concatenating all the vertex dataframe into a single one * computation the mean travel time for each (pattern, seq) couple * fixes the segment travel time computation * now creating the on-board edges * Add create_od_vertices() * Use sql over shape file, data must be mirgated to sqlite first. * Add creation of connector edges * Add attempt at dwell and inner transfer edges * Add missing import * small update * temporarily using 2 sqlite connections in the parameters * renaming within the SQL query * dwell edges creation * small code simplifcation * alighting edges creation * cleanup * wip * compute the mean headway * renaming * filling travel time missing values with travel times computed over all the trips_schedule (now limited to the given time range) * fixed the mean headway computation part * variable renaming * boarding edges creation * concatenate the edges of different types * added a projected CRS to compute distances * now merging within the SQL * cleanup * updated the connector edges creation * creation of the inner stop transfer edges * ability to add spatial noise to boarding and alighting vertex coordinates in order to visualize boarding, aligthing, transfer and collocated on-board edges * creation of the outer stop transfer edges * cleanup + divided the connector type into 2 types: access and egress * added a boolean argument to activate the creation of the outer stop transfer edges * creating some walking edges between the stops of a station * Add overlapping regions for connectors construction. Fix references to graph instead of self * Fix missing edges, add max distance * Fix memory blowout by joining on null and empty strings entries * wip * renaming + merge * typo * casting all stop and parent_station ids to text in sql queries * Using consistent data types during graph transit creation * fixed the cython compilation : added a noexcept in the declaration of _compare * revert to the sequential assignment algorithm (in order to compile) * comments + initialization * Add preliminary db saving Usage: ```python graph = SF_graph_builder(pt_con, prj_con) graph.create_vertices() graph.create_edges() graph.create_additional_db_fields() graph.save_vertices() graph.save_edges() ``` Caveats are noted in the comments of the functions. * Add shifting for duplicated geometry when saving * IDs should be index from 1 Allows the whole graph to be read back into aequilibrae * Rename terms to be more consistent with AequilibraE, use wkb as well We know use WKB format consistently and only convert out when need. String manipulation and regexs have also been replaced. type -> node_type, link_type head_vert_id -> a_node tail_vert_id -> b_node coord -> geometry vert_id -> node_id edge_id -> link_id * Copy over SQL specs for move from proj db to transit storage * Mirror more triggers and tables into transit db Includes files copied from network triggers with slight modifications Need to remove unnecessary columns from links and nodes tables. Zones are still saved to project db and also need to be migrated. * renamed some variables * moved the haversine distance function to the utils submodule * comments * Add custom loading of zones to drop dependence on project db * revert back to the parallel version * added Jake's fix to support Cython 3 * some code cleaning in the travel time computation * Style * cleanup and refactoring * Add direction and to aeq graph conversion * Integrate results saving for hp assignment * typo * Misc post merge fixes and formatting * wip * Add missing results.sql * SQL query update * comments * sql update + public attributes made private * More consistent datatypes This does include a change to make stop_ids TEXT with sqlite. I haven't full explored the effects of this change. * tried to fix an issue with some inverted tail and head IDs for access and egress connectors * set the edge direction attribute to 1 for all edges (all edges are directed) * quick fix to drop duplicated transfer edges * now creating distinct origin and destination nodes * now supporting the blocking_centroid_flows mode when creating the transit graph, where the origin and destination nodes are distinct * added a method to convert taz ids to node ids in the demand matrix * added the max_connectors_per_zone parameter to select at most k connectors per zone with smallest travel time * Scipy 1.6 is 2 years old, prefer KDTree over the cKDTree alias * Add initial connect project matching * Allow troublesome triggers to be disabled * Improvements on the project line string matching. Not complete * Project matching progress * Mimic changes in #455 * fixup! Allow troublesome triggers to be disabled * PathResults.compute_path fix stale variables Previously if a path that exists was computed, and then a path that does not exist was attempted, the old path variables were not cleared. * Working project matching * Use existing line string data for a better result * Refactor project matching into smaller method, add more detailed doc * Misc doc changes + include trigger_settings in db creation * Allow supplying zones as shapely objects, by default add zone * Allow specifying the graph to match against * Style * Adjust to_aeq method to reflect other changes * Use the constructed RNG generator * Documentation overhaul Format doc strings to RST. HTML generated docs look correct. Not sure how to set the class included in the TOC. * Pandas warning fix * Add Coquimbo public transit assignment example * fixup! Add Coquimbo public transit assignment example * updated the docstrings and default values * include SF_graph_builder in the API documentation * made many methods protected * updated the graph builder docstring * bug fix in the case where there is no transfer edges * uniform argument naming when calling pd.read_sql * bug fix dealing with the case of creating walking edges without any parent station * used a newer pandas method to remove future warning * new documentation about transit graph creation * images associated with the transit graph documentation * structure of a new documentation page * completed the hyperpath documentation page * more documentation (HyperpathGenerating) * fix: added dwell edges * PT Integration (#476) * Models with no centroids (#472) * Bumps up version for release * Bumps up version for release * docs --------- Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Better network skimming and path computation headers and typo fix (#474) * Integration scaffolding * Transit assignment * Change "id" variable naming to avoid double underscores Double underscore variables are difficult to inherit without duplicating. I've tried my best to group all these renames into a single commit to be revertible but some others are deep within a refactor. This changes the convention of using `__id__` and `__graph_id__` to `_id` and `_graph_id`. Since these variables need to be accessible to other methods they are not private. The double underscore worked previously since there was only ever one class with these variables the name mangling was always correct. * Create GraphBase and TransitGraph classes * Create TransportClassBase and TransitClass classes * Create AssignmentBass and TransitAssignment classes * Create AssignmentResultsBase and AssignmentResultsTransit classes * Comments, add OptimalStrategies class * Incomplete (full) workflow * fixup! Incomplete (full) workflow * fixes export of omx matrices (#484) Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Move periods table * Lots of changes Limit graph loading and saving to a single graph for now Flush out results API, including saving and loading Move unrelated variables and methods * Add Periods and Period classes, similar to Nodes and Links classes * Remove period from database saving for now * Propagate period ids and various changes * Raise nicer errors * Style * removes use of necessary sqlite3 connection cursors and cached connections (#478) * removes use of necessary sqlite3 connection cursors * removes use of necessary sqlite3 connection cursors and saved connections * removes silly use of a cursor * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles * improves on connection styles --------- Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Migrate docs to new api, fix reloading graphs and begin updating tests. * Style and build errors * Typing * Revert changes to HyperpathGenerating and tests, use arrays instead * Exclude abstract methods from coverage tests * Period, Periods, TransitGraph, and TransitGraphBuilder tests * Style * Cleans graph creation (#482) Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * Adds support page (#481) * updates examples * updates examples * Lower coverage requirement, typos * Remove patches * updates examples * fixup! Remove patches * Missing var * Deprecates Python 3.7 * Fixes documentation * Fixes documentation * code cleaning * code cleaning * code cleaning * updates setup classifiers * Fixes centroid assignment --------- Co-authored-by: Pedro Camargo <c@margo.co> Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov> * renaming --------- Co-authored-by: djfrancesco <pacullfrancois@gmail.com> Co-authored-by: Jake Moss <jake.moss@uqconnect.edu.au> Co-authored-by: François Pacull <35044397+djfrancesco@users.noreply.github.com> Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.